package com.c.ctgproject.wiget.dialog

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import com.c.ctgproject.base.BaseView
import com.c.ctgproject.base.BaseViewModel
import com.c.ctgproject.http.ApiMethods
import com.c.ctgproject.utils.awaitSync
import com.c.ctgproject.utils.launch
import okhttp3.MultipartBody
import java.io.File
import java.util.ArrayList

class FileManagerMoreViewModel : BaseViewModel() {

    private val mResult = MutableLiveData<String>()
    val result: LiveData<String> get() = mResult

    //批量发放回收证明
    fun batchGiveRecycleProof(carIds: List<String>) {
        launch {
            mResult.value = ApiMethods.retrofit.batchGiveRecycleProof(carIds).awaitSync()
        }
    }

    //批量发放注销证明
    fun batchGiveCancellationProof(carIds: List<String>) {
        launch {
            mResult.value = ApiMethods.retrofit.batchGiveCancellationProof(carIds).awaitSync()
        }
    }

    //批量手续发放
//    fun batchGiveProcedure(carIds: List<String>) {
    fun batchGiveProcedure(files: ArrayList<MultipartBody.Part>) {
        launch {
//            mResult.value = ApiMethods.retrofit.batchGiveProcedure(carIds, giveMethod).awaitSync()
            mResult.value = ApiMethods.retrofit.batchGiveProcedure(files).awaitSync()
        }
    }


}